<template>
	<view class="">
		<view class="con">
			<image src="/static/common/loginbg.png" class="bg" mode=""></image>
			<view class="con__info">
				<!-- <view class="con__mobile">
					登录
				</view> -->
				<view class="" style="background-color: white;margin-bottom: 30rpx;width: 547rpx;">
					<u--input placeholder="请输入手机号" border="surround" v-model="log_form.account"></u--input>
				</view>
				<view class="" style="background-color: white;margin-bottom: 30rpx;width: 547rpx;">
					<u--input placeholder="请输入密码" border="surround" v-model="log_form.password"
						type="password"></u--input>
				</view>
				<u-button @click="login3"
					:customStyle="{width:'587rpx',height:'93rpx',padding:0,fontSie:'32rpx',margin:'0 0 40rpx',}"
					shape='circle' color="#FF4D30" text="登录"></u-button>
					<view class="" style="height: 90rpx;">
						
					</view>
	<!-- 			<u-button @click="login2"
					:customStyle="{width:'587rpx',height:'93rpx',padding:0,fontSie:'32rpx',margin:'0 0 120rpx',color:'black'}"
					shape='circle' color="#dcdcdc" text="一键授权登录/注册" :hairline="true" :plain="true"></u-button> -->
			</view>
		</view>
		<view class="footer">
			<view class="tip" @click="other" style="position: relative;z-index: 99;">
				没有账号，前去注册
			</view>
			<image src="/static/common/wx.png" class="vx" mode="" style="opacity: 0;"></image>
			<view class="u-flex u-flex-y-center">
				<u-checkbox-group v-model="checkboxValue1" activeColor="#ff4d30">
					<u-checkbox :customStyle="{marginRight: '5rpx'}" shape="circle">
					</u-checkbox>
				</u-checkbox-group>
				<view class="text">我已阅读并同意
					<text style="font-size: 24rpx;color: #FF4D30;">《用户协议》</text>和
					<text style="font-size: 24rpx;color: #FF4D30;">《隐私政策》</text>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		login
	} from "@/request/api/login.js"
	
	export default {
		data() {
			return {
				log_form: {
					"account": "",
					"password": "",
				},
				checkboxValue1: [],
			}
		},
		onLoad() {

		},
		methods: {
			login3() {

				if (!this.log_form.account) {
					uni.$u.toast('请先输入手机号');
					return
				}
				if (!this.log_form.password) {
					uni.$u.toast('请输入密码');
					return
				}

				if (this.checkboxValue1.length == 0) {
					uni.$u.toast('请阅读并同意《用户协议》和《隐私政策》');
					return
				}
				login(this.log_form).then(res => {
					if (res.code == 1) {
						uni.setStorageSync("token", res.data.userinfo.token);
						uni.setStorageSync("userInfo", res.data.userinfo);
						uni.reLaunch({
							url: "/pages/tabbar/home"
						})
					}
				})

			},
			other() {
				uni.reLaunch({
					url: "/pages/index/reg"
				})
			},
			login2() {
				uni.reLaunch({
					url: "/pages/index/login"
				})
			},
		}
	}
</script>

<style lang="scss">
	.bg {
		width: 750rpx;
		height: 1171rpx;
		position: absolute;
		top: 0;
		left: 0;
	}

	.con {
		position: relative;
		width: 750rpx;
		height: 1171rpx;

		&__info {
			position: absolute;
			bottom: 0;
			width: 750rpx;
			left: 0;
			display: flex;
			flex-direction: column;
			align-items: center;
		}

		&__mobile {
			font-family: PingFang-SC, PingFang-SC;
			font-weight: bold;
			font-size: 44rpx;
			color: #1E1E1E;
			line-height: 34rpx;
			margin-bottom: 32rpx;
		}

		&__text {
			font-family: PingFang-SC, PingFang-SC;
			font-weight: bold;
			font-size: 24rpx;
			color: #949494;
			line-height: 24rpx;
			margin-bottom: 52rpx;
		}

	}

	.footer {
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-top: -80rpx;
		padding-bottom: 60rpx;

		.tip {
			font-family: PingFang-SC, PingFang-SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #9A9A9A;
			line-height: 24rpx;
		}

		.vx {
			width: 84rpx;
			height: 81rpx;
			margin: 40rpx 0;
		}

		.text {
			font-family: PingFang-SC, PingFang-SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #9A9A9A;
			line-height: 24rpx;
			display: flex;
			align-items: center;
		}
	}
</style>